package com.tedu.project5.controller;

import com.tedu.project5.common.Result;
import com.tedu.project5.dto.RegisterDto;
import com.tedu.project5.service.IDdUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//@Controller    // 返回的字符串是页面的名称，会跳转到该页面
@RestController    //返回的对象会转为json格式的数据，返回的字符串就是字符串
@RequestMapping("/sys")    //广西自治区
public class RegisterController {

    /**
     * 依赖服务层
     */
    @Autowired //注入服务层的对象
    private IDdUserService iDdUserService;


    /**
     * 注册接口.
     * @return the rest
     * htpp://localhost:9999/sys/register
     */
    @PostMapping("/register")   //南宁市
    public Result register(@RequestBody RegisterDto dto) {

        return iDdUserService.register(dto);
    }


}
